package com.donleo.stmg.relation.service.impl;

import com.donleo.stmg.common.api.CommonResult;
import com.donleo.stmg.relation.model.TeamChangeRecord;
import com.donleo.stmg.relation.mapper.TeamChangeRecordMapper;
import com.donleo.stmg.relation.service.TeamChangeRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.donleo.stmg.relation.vo.TeamChangeRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 换组记录表 服务实现类
 * </p>
 *
 * @author liangd
 * @since 2020-12-21
 */
@Service
public class TeamChangeRecordServiceImpl extends ServiceImpl<TeamChangeRecordMapper, TeamChangeRecord> implements TeamChangeRecordService {

    @Autowired
    private TeamChangeRecordMapper teamChangeRecordMapper;

    @Override
    public List<TeamChangeRecord> findAll(TeamChangeRecordVo teamChangeRecordVo) {
        return teamChangeRecordMapper.findAll(teamChangeRecordVo);
    }

    @Override
    public long getCount(TeamChangeRecordVo teamChangeRecordVo) {
        return teamChangeRecordMapper.getCount(teamChangeRecordVo);
    }

    @Override
    public CommonResult deletes(List<Integer> idsList) {

        int i = teamChangeRecordMapper.deleteBatchIds(idsList);
        if (i > 0) {
            return CommonResult.success(i);
        }
        return CommonResult.failed();
    }
}
